package com.parking.status.sync.netty.client;

import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.string.StringEncoder;

import java.net.URLEncoder;
import java.nio.charset.Charset;
import java.util.List;

/**
 * Created by Administrator on 2015/9/22.
 */
public class RequestUrlStringEncoder extends StringEncoder{

    public RequestUrlStringEncoder() {
        super(Charset.forName("Utf-8"));
    }

    @Override
    protected void encode(ChannelHandlerContext ctx, CharSequence msg, List<Object> out) throws Exception {

        String src = msg.toString().replace("\r\n", "").replace(" ", "");
        String dest = src;//URLEncoder.encode(src, "Utf-8");
        super.encode(ctx, dest, out);
    }
}
